const RESPONSE_CODES = {
  'success': 200,
  'accepted': 202,
  'noContent': 204,
  'redirection': 300,
  'badRequest': 400,
  'unprocessable': 422,
  'serverError': 500
};

const Responses = {
  success (body) {
    return formatResponse(RESPONSE_CODES.success, body);
  },
  accepted (body) {
    return formatResponse(RESPONSE_CODES.accepted, body);
  },
  noContent (body) {
    return formatResponse(RESPONSE_CODES.noContent, body);
  },
  redirection (body) {
    return formatResponse(RESPONSE_CODES.redirection, body);
  },
  badRequest (body) {
    return formatResponse(RESPONSE_CODES.badRequest, body);
  },
  unprocessable (body) {
    return formatResponse(RESPONSE_CODES.unprocessable, body);
  },
  serverError (body) {
    return formatResponse(RESPONSE_CODES.serverError, body);
  }
};

function formatResponse (statusCode, body) {
  return {
    'statusCode': statusCode,
    'isBase64Encoded': false,
    'body': JSON.stringify(body)
  };
}

exports.RESPONSE_CODES = RESPONSE_CODES;
exports.Responses = Responses;
